from fastapi import APIRouter
from sqlalchemy.orm import Session

from app.api.deps import DbDependency
from app.crud import attr_service
from app.schemas.attribute import AttributeBo, AttributeGroupBo

router = APIRouter()


@router.get("/list", description="商品列表")
def list_brands(db: DbDependency, categoryId: int):
    return attr_service.query_att_by_category_id(db, categoryId)


@router.post("/group/modify", description="新增商品")
def att_group_modify(att: AttributeGroupBo, db: DbDependency):
    return attr_service.att_group_modify(db, att)


@router.post("/att/modify", description="修改商品")
def att_modify(db: DbDependency, att: AttributeBo):
    return attr_service.att_modify(db, att)
